<template>
  <vue-count-to
    v-bind="$attrs"
    v-on="$listeners"
    :start-val="startVal"
    :end-val="endVal"
  />
</template>
<script>
import VueCountTo from 'vue-count-to'
export default {
  name: 'CountTo',
  inheritAttrs: false,
  components: {
    VueCountTo,
  },
  props: {
    value: {
      type: Number,
      default: 0,
    },
  },
  data () {
    return {
      startVal: 0,
      endVal: 0,
    }
  },
  watch: {
    value: {
      immediate: true,
      handler (newVal, oldVal) {
        this.startVal = oldVal
        this.endVal = newVal
      },
    },
  },
}
</script>
<style scoped>

</style>